#!/bin/bash
# ============================================================
# Script Name:    auxSystemBringup.sh
# Description:    启动AGV系统的辅助功能模块
#                 包括EKF扩展卡尔曼滤波、电池监控和驱动记录等功能
# Author:         haibo
# Created Date:   2025-07-24
# Version:        1.0
# Modified Date:  2025-09-09
# Modified By:    haibo
# Modification:   初始版本
# Usage:          ./auxSystemBringup.sh [日志文件路径]
# Notes:          1. 依赖ROS参数服务器中的配置参数
#                 2. 需要common.sh公共函数库支持
#                 3. 各功能模块独立配置和启动
# ============================================================
source ${HOME}/lgimRobot/bin/common "$@"

main() {
    # EKF扩展卡尔曼滤波
    [ "$(get_ros2_param "base.controllers.twist_controller.enable_ekf.value")" = "true" ] && \
        launch_node "EKF滤波" ros2 run robot_pose_ekf robot_pose_ekf_node
    
    # Rebot电池
    [ "$(get_ros2_param "battery.type.value")" = "rebot" ] && \
        launch_node "电池监控" ros2 run battery rebot_battery_info_node
    
    # 驱动记录
    [ "$(get_ros2_param "AGVParam.driver_record.value")" = "true" ] && \
        launch_node "驱动记录" ros2 run pose_analysis driver_info_record_node
    
    return 0
}

main